<include file="public:top" />
<!--编辑菜单-->
<form class="layui-form layui-form-pane" action="" style="padding:20px;">
   <input type="hidden" name="img" id="J_img">
   
  <div class="layui-form-item">
    <label class="layui-form-label">标题</label>
    <div class="layui-input-block">
      <input type="text" name="title" id="title" placeholder="请输入" class="layui-input" value="{$info.title}">
    </div>
  </div>

  <div class="layui-form-item" id="ad_code">
    <label class="layui-form-label">接收人</label>
    <div class="layui-input-block">
       <textarea name="code" id="to_name" class="layui-textarea" placeholder="会员名中间用半角逗号,隔开，不填则为全部会员"></textarea>
    </div>
  </div>
 
  <div class="layui-form-item" id="ad_code">
    <label class="layui-form-label">信息内容</label>
    <div class="layui-input-block">
       <textarea name="info" id="info" class="layui-textarea"></textarea>
    </div>
  </div>
    
  <div class="layui-form-item">
        <label class=""></label>
        <div class="layui-input-block">
        <button class="layui-btn" lay-submit="" lay-filter="upbtn">发送通知</button>
        </div>
    </div>
</form>

<script>
//Demo
layui.use(['layer','jquery','form','upload'], function () {
    // 操作对象
    var layer = layui.layer,$ = layui.jquery,form = layui.form, upload = layui.upload;
    
   // 提交
   // 提交
    form.on('submit(upbtn)', function (data) {
        // 提交到方法 默认为本身
        $.post("{:u('user_mail/add')}",data.field,function(res){
            if(res.status ==  1){
                layer.msg(res.msg,{time:1800},function(){
                    //关闭弹层后刷新父页面
                    window.parent.location.reload();
                    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
                    parent.layer.close(index); 
                });
            }else{
                layer.msg(res.msg,{time:1800},function(){
                    //关闭弹层后刷新父页面
                    window.parent.location.reload();
                    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
                    parent.layer.close(index); 
                });
            }
        });
        return false;
    });



    

});
</script>